package com.binarysearch;

public class Solution852 {
    public int peakIndexInMountainArray(int[] arr) {
        int i = 0;
        int j = arr.length - 1;
        while (i < j) {
            int mid = i + j + 1 >> 1;
            if (arr[mid - 1] < arr[mid]) i = mid;
            else j = mid - 1;
        }
        return i;
    }
}
